package com.nd.controller;

import com.nd.common.result.ResultUtils;
import com.nd.entity.Desk;
import com.nd.service.IDeskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhaoyan
 * @since 2024-12-25
 */
@RestController
@RequestMapping("/desk")
public class DeskController {

    @Autowired
    IDeskService service;


    /**
     *全查
     * @return
     */
    @GetMapping("/")
    public Object getList(){
        List<Desk> list = service.list();
        return ResultUtils.returnSuccessLayui(list,list.size());
    }


//    @GetMapping("/{id}")
//    public Object getById(@PathVariable("id")Integer id){
//        return deskService.getById(id);
//    }
//
//    @DeleteMapping("/{id}")
//    public Object del(@PathVariable("id")Integer id){
//        if(deskService.removeById(id)) return ResultUtils.returnSuccess();
//        else return ResultUtils.returnFail("删除失败");
//    }
//
//    @PostMapping ("/")
//    public Object add(@RequestBody Desk desk){
//        if(deskService.save(desk)) return ResultUtils.returnSuccess();
//        else return ResultUtils.returnFail("添加失败");
//    }
//
//    @PutMapping("/")
//    public Object updateById(@RequestBody Desk desk){
//        if(deskService.updateById(desk)) return ResultUtils.returnSuccess();
//        else return ResultUtils.returnFail("修改失败");
//    }

}
